package cn.janyd.action.template;

import cn.janyd.action.Constants;
import com.google.common.collect.Maps;
import lombok.Builder;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * @author janyd
 * @since 2020/8/7 19:43
 */
@Data
@Builder
public class MapperXml implements CodeTemplate {

    private String mapperPackageName;

    private String mapperName;

    private boolean baseResultMap;

    private String dataObjectPackage;

    private String dataObjectName;

    private List<DataObjectClass.Field> commonFields;

    private List<DataObjectClass.Field> fields;

    private String fieldNames;

    /**
     * 获取模板
     *
     * @return 模板
     */
    @Override
    public String getTemplatePath() {
        return Constants.MAPPER_XML_TEMPLATE;
    }

    /**
     * 获取模板填充的数据
     *
     * @return 数据
     */
    @Override
    public Map<String, Object> getObjectMap() {
        Map<String, Object> objectMap = Maps.newHashMap();
        objectMap.put("mapper", this);
        return objectMap;
    }
}
